import { Entity, Column, Index } from 'typeorm';
import { BaseEntity } from './base.entity';

@Entity('banners')
export class Banner extends BaseEntity {

    @Column({
        name: 'title',
        type: 'varchar',
        length: 100,
        nullable:false,
        comment: 'Banner标题，最大长度100字符'
    })
    title?: string;

    @Column({
        name: 'image_url',
        type: 'varchar',
        length: 255,
        nullable:false,
        comment: '图片URL地址，必须为有效URL'
    })
    imageUrl?: string;

    @Column({
        name: 'link_url',
        type: 'varchar',
        length: 255,
        nullable: true,
        comment: '点击跳转链接（可选），必须为有效URL'
    })
    linkUrl?: string;

    @Column({
        name: 'sort_order',
        type: 'int',
        default: 0,
        comment: '排序权重，数值越小越靠前，默认0'
    })
    sortOrder?: number;

    @Column({
        name: 'is_active',
        type: 'int',
        default: 1,
        comment: '是否激活状态，默认true'
    })
    isActive?: number;

}